package com.latefly.skewwork.data

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.latefly.skewwork.data.entity.User
import com.latefly.skewwork.data.repository.UserRepository

@Database(entities = [User::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
    abstract fun userRepository(): UserRepository

}

fun createDataBase(context: Context, name: String): AppDatabase {
    return Room.databaseBuilder(
        context,
        AppDatabase::class.java, name
    ).build()
}
/*
    db.userRepository().insert(User(1, "John", 25))
    val users = db.userRepository().getAll()
*/